# -.- coding:utf-8 -.-# __author__ = 'zhengtong'方法一：from  operator import add, sub, mul, truedivimport randomclass Clo:    def __init__(self, left= None, operator= None, right=None):        self.left = left        self.operator = operator        self.right = right        self.math = {'+': add, '-': sub, '*': mul, '/': truediv}    def run(self):        result =self.math.get(self.operator)(self.left, self.right)        print(result)if __name__ == '__main__':    #从1到100中做任意取两位数进行四则运算    Clo(random.choice(range(1, 100)), '+', random.choice(range(1, 100))).run()    Clo(random.choice(range(1, 100)), '-', random.choice(range(1, 100))).run()    Clo(random.choice(range(1, 100)), '*', random.choice(range(1, 100))).run()    Clo(random.choice(range(1, 100)), '/', random.choice(range(1, 100))).run()